<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php  JHTML::_('behavior.tooltip');  ?>

<?php

    //添加toolbar 按钮
	JToolBarHelper::title( JText::_( '消息管理' ), 'inbox.png' );
//	JToolBarHelper::custom( 'logout', 'cancel.png', 'cancel_f2.png', 'Logout' );
	JToolBarHelper::deleteList('你真的要封禁该消息吗？','enban','封禁消息');
	JToolBarHelper::deleteList('你真的要解封该消息吗？','unban','解封消息');
    JToolBarHelper::deleteList('你真的要设置该消息为待审核状态吗？','settodo','设为待审核');
//	JToolBarHelper::editListX('edit','消息设置');
//	JToolBarHelper::addNewX();
//	JToolBarHelper::help( 'screen.users' );
?>

<form action="index.php?option=com_notices" method="post" name="adminForm">
	<table>
		<tr>
			<td width="100%">
				<?php echo JText::_( '搜索' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_type').value='0';this.form.getElementById('filter_logged').value='0';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['type'];?>
				<?php //echo $this->lists['logged'];?>
			</td>
		</tr>
	</table>

	<table class="adminlist" cellpadding="1">
		<thead>
			<tr>
				<th width="2%" class="title">
					<?php echo JText::_( 'NUM' ); ?>
				</th>
				<th width="3%" class="title">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
				</th>
				<th width="1%" class="title" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',   '消息ID', 'a.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="8%" class="title">
					<?php echo JHTML::_('grid.sort',   '用户ID', 'a.profile_id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="30%" class="title" >
					<?php echo  JText::_( '消息内容' );?>
				</th>
				<th width="10%" class="title">
					<?php echo JHTML::_('grid.sort',   '发布时间', 'a.created', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				<th width="5%" class="title" nowrap="nowrap">
					<?php echo JText::_( '是否封禁' );?>
				</th>
			
				
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="10">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)
			{
				$row 	=& $this->items[$i];

//				$img 	= $row->is_banned ? 'tick.png' : '';
//				$task 	= $row->is_banned ? 'unban' : 'enban';
//				$alt 	= $row->is_banned ? JText::_( '解封' ) : JText::_( '封禁' );
                
				$link 	= 'index.php?option=com_users&amp;view=user&amp;task=edit&amp;cid[]='. $row->profile_id. '';
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo $i+1+$this->pagination->limitstart;?>
				</td>
				<td>
					<?php echo JHTML::_('grid.id', $i, $row->id ); ?>
				</td>
				<td>
					<?php echo $row->id; ?>
				</td>
				<td>
					<a href="<?php echo $link; ?>">
						<?php echo $row->profile_id; ?></a>
				</td>
				<td>
					<?php echo $row->content; ?>
				</td>
				<td nowrap="nowrap">
					<?php echo $row->created; ?>
				</td>
				<td align="center">
				<?php switch ($row->is_banned)
						{
							case 1:
								echo '已封禁消息';
								break;
							case 2:
								echo '待审核消息';
								break;
							case 0:
								echo '普通消息';
								break;
							default:
								echo '普通消息';
								break;
						}
				?>	
				</td>
				
			</tr>
			<?php
				$k = 1 - $k;
				}
			?>
		</tbody>
	</table>

	<input type="hidden" name="option" value="com_notices" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>